<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>存储过程 | Manor Farm Mysql</title>
    <meta name="generator" content="VuePress 1.7.1">
    <link rel="icon" href="/manor-farm-mysql/pgmanor_mysql.svg">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css">
    <script language="javascript" type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script language="javascript" type="text/javascript" src="/manor-farm-mysql/js/MouseClickEffect.js"></script>
    <script language="javascript" type="text/javascript" src="/manor-farm-mysql/js/pgmanor-self.js"></script>
    <meta name="description" content="Mysql学习手册">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    
    <link rel="preload" href="/manor-farm-mysql/assets/css/0.styles.7bfce8db.css" as="style"><link rel="preload" href="/manor-farm-mysql/assets/js/app.bbd54b43.js" as="script"><link rel="preload" href="/manor-farm-mysql/assets/js/3.33fa8ee0.js" as="script"><link rel="preload" href="/manor-farm-mysql/assets/js/1.e501e4e7.js" as="script"><link rel="preload" href="/manor-farm-mysql/assets/js/41.64d0c11a.js" as="script"><link rel="preload" href="/manor-farm-mysql/assets/js/8.73e907b5.js" as="script"><link rel="prefetch" href="/manor-farm-mysql/assets/js/10.31e485b8.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/11.bd87e4cf.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/12.0fe1282f.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/13.f1de335a.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/14.4a84a4ee.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/15.bc190a07.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/16.3f42a3ab.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/17.f1cad67c.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/18.e8063fee.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/19.068739ed.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/20.2b248747.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/21.4fd4cbc1.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/22.2683cc54.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/23.2e39bbe5.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/24.560a4164.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/25.26555323.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/26.8b7e1943.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/27.0f4ac9a1.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/28.f89ec4c0.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/29.71c751c3.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/30.ad576991.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/31.2746a45e.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/32.b62e21d8.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/33.ae9d6c1c.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/34.53969cd0.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/35.3e1a8a01.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/36.eb74300d.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/37.16568451.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/38.9a3bc894.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/39.7aab5a75.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/4.c231685d.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/40.cd44603a.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/42.3fb5d657.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/43.d4f19236.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/44.6abd5f31.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/45.eaf7b761.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/46.d891856e.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/5.0292b513.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/6.df2ba939.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/7.3b1acb14.js"><link rel="prefetch" href="/manor-farm-mysql/assets/js/9.5220a7da.js">
    <link rel="stylesheet" href="/manor-farm-mysql/assets/css/0.styles.7bfce8db.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container" data-v-2d5f533b><div data-v-2d5f533b><div id="loader-wrapper" class="loading-wrapper" data-v-d48f4d20 data-v-2d5f533b data-v-2d5f533b><div class="loader-main" data-v-d48f4d20><div data-v-d48f4d20></div><div data-v-d48f4d20></div><div data-v-d48f4d20></div><div data-v-d48f4d20></div></div> <!----> <!----></div> <div class="password-shadow password-wrapper-out" style="display:none;" data-v-59a94c5a data-v-2d5f533b data-v-2d5f533b><h3 class="title" style="display:none;" data-v-59a94c5a data-v-59a94c5a>Manor Farm Mysql</h3> <!----> <label id="box" class="inputBox" style="display:none;" data-v-59a94c5a data-v-59a94c5a><input type="password" value="" data-v-59a94c5a> <span data-v-59a94c5a>已加密!</span> <button data-v-59a94c5a>OK</button></label> <div class="footer" style="display:none;" data-v-59a94c5a data-v-59a94c5a><span data-v-59a94c5a><i class="iconfont reco-eye" data-v-59a94c5a></i> <a target="blank" href="https://pgmanor.gitee.io/blog/" data-v-59a94c5a>密钥</a></span> <span data-v-59a94c5a><i class="iconfont reco-theme" data-v-59a94c5a></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-59a94c5a>vuePress-theme-reco</a></span> <span data-v-59a94c5a><i class="iconfont reco-copyright" data-v-59a94c5a></i> <a data-v-59a94c5a><span data-v-59a94c5a>pgmanor</span>
  
<!---->
2021
</a></span></div></div> <div class="hide" data-v-2d5f533b><header class="navbar" data-v-2d5f533b><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/manor-farm-mysql/" class="home-link router-link-active"><img src="/manor-farm-mysql/pgmanor_mysql.svg" alt="Manor Farm Mysql" class="logo"> <span class="site-name">Manor Farm Mysql</span></a> <div class="links"><div class="color-picker"><a class="color-button"><i class="iconfont reco-color"></i></a> <div class="color-picker-menu" style="display:none;"><div class="mode-options"><h4 class="title">Choose mode</h4> <ul class="color-mode-options"><li class="dark">dark</li><li class="auto active">auto</li><li class="light">light</li></ul></div></div></div> <div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/manor-farm-mysql/zh/guide/" class="nav-link router-link-active"><i class="iconfont reco-api"></i>
  指南
</a></div><div class="nav-item"><a href="/manor-farm-mysql/zh/fix/messageBoard.html" class="nav-link"><i class="iconfont reco-suggestion"></i>
  留言版
</a></div><div class="nav-item"><a href="https://pgmanor.gitee.io/blog/2021/01/10/secret-farm-mysql/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-eye"></i>
  文章密钥
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-qq"></i>
      联系
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><h4>QQ在线</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="https://wpa.qq.com/msgrd?v=3&amp;uin=2307546059&amp;site=qq&amp;menu=yes" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont undefined"></i>
  pgmanor
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></li><li class="dropdown-item"><h4>其他方式</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/manor-farm-mysql/zh/fix/contactUs.html" class="nav-link"><i class="iconfont undefined"></i>
  更多
</a></li></ul></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-other"></i>
      友链
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><h4>博客</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="https://pgmanor.gitee.io/blog/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont undefined"></i>
  pgmanor
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-subitem"><a href="https://blog.csdn.net/u011622109" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-csd"></i>
  csdn
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-subitem"><a href="https://www.iworkh.com" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont undefined"></i>
  iworkh
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></li><li class="dropdown-item"><h4>Vue</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="https://cn.vuejs.org/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont undefined"></i>
  Vue
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-subitem"><a href="https://v1.vuepress.vuejs.org/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont undefined"></i>
  VuePress
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-subitem"><a href="https://vuepress-theme-reco.recoluan.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont undefined"></i>
  vuepress-theme-reco
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></li></ul></div></div><div class="nav-item"><a href="/manor-farm-mysql/zh/fix/donate.html" class="nav-link"><i class="iconfont reco-Coding"></i>
  捐赠
</a></div><div class="nav-item"><a href="https://gitee.com/pgmanor/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-mayun"></i>
  Gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div> <!----></nav></div></header> <div class="sidebar-mask" data-v-2d5f533b></div> <aside class="sidebar" data-v-2d5f533b><div class="personal-info-wrapper" data-v-ca798c94 data-v-2d5f533b><img src="/manor-farm-mysql/pgmanor_mysql.svg" alt="author-avatar" class="personal-img" data-v-ca798c94> <h3 class="name" data-v-ca798c94>
    pgmanor
  </h3> <div class="num" data-v-ca798c94><div data-v-ca798c94><h3 data-v-ca798c94>30</h3> <h6 data-v-ca798c94>文章</h6></div> <div data-v-ca798c94><h3 data-v-ca798c94>26</h3> <h6 data-v-ca798c94>标签</h6></div></div> <hr data-v-ca798c94></div> <nav class="nav-links"><div class="nav-item"><a href="/manor-farm-mysql/zh/guide/" class="nav-link router-link-active"><i class="iconfont reco-api"></i>
  指南
</a></div><div class="nav-item"><a href="/manor-farm-mysql/zh/fix/messageBoard.html" class="nav-link"><i class="iconfont reco-suggestion"></i>
  留言版
</a></div><div class="nav-item"><a href="https://pgmanor.gitee.io/blog/2021/01/10/secret-farm-mysql/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-eye"></i>
  文章密钥
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-qq"></i>
      联系
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><h4>QQ在线</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="https://wpa.qq.com/msgrd?v=3&amp;uin=2307546059&amp;site=qq&amp;menu=yes" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont undefined"></i>
  pgmanor
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></li><li class="dropdown-item"><h4>其他方式</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/manor-farm-mysql/zh/fix/contactUs.html" class="nav-link"><i class="iconfont undefined"></i>
  更多
</a></li></ul></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-other"></i>
      友链
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><h4>博客</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="https://pgmanor.gitee.io/blog/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont undefined"></i>
  pgmanor
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-subitem"><a href="https://blog.csdn.net/u011622109" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-csd"></i>
  csdn
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-subitem"><a href="https://www.iworkh.com" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont undefined"></i>
  iworkh
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></li><li class="dropdown-item"><h4>Vue</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="https://cn.vuejs.org/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont undefined"></i>
  Vue
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-subitem"><a href="https://v1.vuepress.vuejs.org/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont undefined"></i>
  VuePress
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-subitem"><a href="https://vuepress-theme-reco.recoluan.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont undefined"></i>
  vuepress-theme-reco
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></li></ul></div></div><div class="nav-item"><a href="/manor-farm-mysql/zh/fix/donate.html" class="nav-link"><i class="iconfont reco-Coding"></i>
  捐赠
</a></div><div class="nav-item"><a href="https://gitee.com/pgmanor/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-mayun"></i>
  Gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div> <!----></nav> <ul class="sidebar-links"><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>初入尘世</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/manor-farm-mysql/zh/guide/essentials/e-01-install.html" class="sidebar-link">安装</a></li><li><a href="/manor-farm-mysql/zh/guide/essentials/e-02-ddl-dcl.html" class="sidebar-link">DDL语句</a></li><li><a href="/manor-farm-mysql/zh/guide/essentials/e-03-dml.html" class="sidebar-link">DML语句</a></li><li><a href="/manor-farm-mysql/zh/guide/essentials/e-04-sort.html" class="sidebar-link">sort排序</a></li><li><a href="/manor-farm-mysql/zh/guide/essentials/e-05-group.html" class="sidebar-link">group分组</a></li><li><a href="/manor-farm-mysql/zh/guide/essentials/e-06-union.html" class="sidebar-link">union合并</a></li><li><a href="/manor-farm-mysql/zh/guide/essentials/e-07-join.html" class="sidebar-link">join</a></li><li><a href="/manor-farm-mysql/zh/guide/essentials/e-08-transaction.html" class="sidebar-link">事务</a></li><li><a href="/manor-farm-mysql/zh/guide/essentials/e-09-view.html" class="sidebar-link">视图</a></li><li><a href="/manor-farm-mysql/zh/guide/essentials/e-10-procedure.html" aria-current="page" class="active sidebar-link">存储过程</a></li><li><a href="/manor-farm-mysql/zh/guide/essentials/e-11-function.html" class="sidebar-link">函数</a></li><li><a href="/manor-farm-mysql/zh/guide/essentials/e-12-index.html" class="sidebar-link">索引</a></li><li><a href="/manor-farm-mysql/zh/guide/essentials/e-13-devops.html" class="sidebar-link">运维</a></li></ul></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>千锤百炼</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/manor-farm-mysql/zh/guide/advanced/a-01-introduction.html" class="sidebar-link">本章介绍</a></li><li><a href="/manor-farm-mysql/zh/guide/advanced/a-02-prepare-data.html" class="sidebar-link">数据准备</a></li><li><section class="sidebar-group collapsable is-sub-group depth-1"><a href="/manor-farm-mysql/zh/guide/" class="sidebar-heading clickable router-link-active"><span>原理</span> <span class="arrow right"></span></a> <!----></section></li><li><section class="sidebar-group collapsable is-sub-group depth-1"><a href="/manor-farm-mysql/zh/guide/" class="sidebar-heading clickable router-link-active"><span>优化</span> <span class="arrow right"></span></a> <!----></section></li></ul></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>百战成神</span> <span class="arrow right"></span></p> <!----></section></li></ul> </aside> <div class="password-shadow password-wrapper-in" style="display:none;" data-v-59a94c5a data-v-2d5f533b><h3 class="title" style="display:none;" data-v-59a94c5a data-v-59a94c5a>存储过程</h3> <!----> <label id="box" class="inputBox" style="display:none;" data-v-59a94c5a data-v-59a94c5a><input type="password" value="" data-v-59a94c5a> <span data-v-59a94c5a>已加密!</span> <button data-v-59a94c5a>OK</button></label> <div class="footer" style="display:none;" data-v-59a94c5a data-v-59a94c5a><span data-v-59a94c5a><i class="iconfont reco-eye" data-v-59a94c5a></i> <a target="blank" href="https://pgmanor.gitee.io/blog/" data-v-59a94c5a>密钥</a></span> <span data-v-59a94c5a><i class="iconfont reco-theme" data-v-59a94c5a></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-59a94c5a>vuePress-theme-reco</a></span> <span data-v-59a94c5a><i class="iconfont reco-copyright" data-v-59a94c5a></i> <a data-v-59a94c5a><span data-v-59a94c5a>pgmanor</span>
  
<!---->
2021
</a></span></div></div> <div data-v-2d5f533b><main class="page"><div class="page-title" style="display:none;"><h1 class="title">存储过程</h1> <div data-v-3b7f5bdf><i class="iconfont reco-account" data-v-3b7f5bdf><span data-v-3b7f5bdf>pgmanor</span></i> <i class="iconfont reco-date" data-v-3b7f5bdf><span data-v-3b7f5bdf>2021-01-01</span></i> <i class="iconfont reco-eye" data-v-3b7f5bdf><span id="/manor-farm-mysql/zh/guide/essentials/e-10-procedure.html" data-flag-title="Your Article Title" class="leancloud-visitors" data-v-3b7f5bdf><a class="leancloud-visitors-count" style="font-size:.9rem;font-weight:normal;color:#999;"></a></span></i> <i class="iconfont reco-tag tags" data-v-3b7f5bdf><span class="tag-item" data-v-3b7f5bdf>procedure</span></i></div></div> <div class="theme-reco-content content__default" style="display:none;"><p>本文主要介绍下mysql的存储过程</p> <div id="boxx" data-v-f4ca0dac><div data-v-f4ca0dac><p v-if="true" class="custom-block-title" data-v-f4ca0dac></p> <p v-if="true" data-v-f4ca0dac></p></div></div> <h2 id="_1-what">1.what</h2> <p>存储过程是一组为了完成特定功能的 SQL 语句集合。</p> <blockquote><p>使用存储过程的目的是将常用或复杂的工作预先用 SQL 语句写好并用一个指定名称存储起来。</p> <p>这个过程经编译和优化后存储在数据库服务器中，因此称为存储过程。</p> <p>当以后需要数据库提供与已定义好的存储过程的功能相同的服务时，只需调用<code>CALL存储过程名字</code>即可自动完成。</p></blockquote> <p><strong>存储过程思想</strong>：就是数据库SQL语言层面的代码封装与重用。</p> <p><strong>优点</strong></p> <ul><li>存储过程可封装，并隐藏复杂的商业逻辑。</li> <li>可减少网络流量。</li> <li>高性能。编写好后就存在服务器端，客户端可以直接调用。注意，存储过程太多也不好，影响性能。</li></ul> <p><strong>缺点</strong></p> <ul><li>存储过程，受制于数据厂商。因为支持的编程语言不同。当切换到其他厂商的数据库系统时，需要重写原有的存储过程。</li></ul> <p>所以存储过程在工作中使用的并不是很多，在银行一些项目中有使用，其他除非非必要场合基本都不用。</p> <blockquote><p>为了本册的完整性，我们还是简单的介绍下。</p></blockquote> <h2 id="_2-创建删除">2.创建删除</h2> <p><strong>语法</strong></p> <div class="language-sql line-numbers-mode"><pre class="language-sql"><code><span class="token keyword">CREATE</span> <span class="token keyword">PROCEDURE</span> <span class="token operator">&lt;</span>过程名<span class="token operator">&gt;</span> <span class="token punctuation">(</span> <span class="token punctuation">[</span>过程参数<span class="token punctuation">[</span><span class="token punctuation">,</span>…<span class="token punctuation">]</span> <span class="token punctuation">]</span> <span class="token punctuation">)</span>
<span class="token keyword">BEGIN</span>
    <span class="token operator">&lt;</span>过程体<span class="token operator">&gt;</span>
<span class="token keyword">END</span> 结束符
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><ul><li>过程参数格式: <code>IN/OUT/INOUT 参数名 类型</code> <ul><li>IN 输入参数：表示调用者向过程传入值（传入值可以是字面量或变量）</li> <li>OUT 输出参数：表示过程向调用者传出值(可以返回多个值)（传出值只能是变量</li> <li>INOUT 输入输出参数：既表示调用者向过程传入值，又表示过程向调用者传出值（值只能是变量）</li></ul></li> <li>过程体,以关键字 BEGIN 开始，以关键字 END 结束。若存储过程体中只有一条 SQL 语句，则可以省略 BEGIN-END 标志。</li> <li>DELIMITER: mysql中默认的以<code>;</code>作为结束符的，到那时在存储<code>过程体</code>中，多个语句都是以<code>;</code>结束，所以我们需要换一个结束符，则需要<code>DELIMITER</code></li></ul> <div class="language-sql line-numbers-mode"><pre class="language-sql"><code><span class="token keyword">DELIMITER</span> $$
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><blockquote><p>定义两个美元符号<code>$$</code>为结束符，也可以其他符号，避免使用反斜杠<code>\</code>字符，因为它是 MySQL 的转义字符。</p></blockquote> <p><strong>示例</strong></p> <p>定义ShowStuByName存储过程</p> <div class="language-sql line-numbers-mode"><pre class="language-sql"><code><span class="token comment">-- 使用$$作为结束符</span>
<span class="token keyword">DELIMITER</span> $$ 
<span class="token keyword">CREATE</span> <span class="token keyword">PROCEDURE</span> ShowStuByName<span class="token punctuation">(</span><span class="token operator">IN</span> p_name <span class="token keyword">VARCHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token keyword">BEGIN</span>
    <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> student <span class="token keyword">where</span> name<span class="token operator">=</span>p_name<span class="token punctuation">;</span>
<span class="token keyword">END</span> $$
<span class="token comment">-- 切换回;作为结束符</span>
<span class="token keyword">DELIMITER</span> <span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br></div></div><div class="language-sql line-numbers-mode"><pre class="language-sql"><code>DROPP ROCEDURE ShowStuByName
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>调用ShowStuByName存储过程</p> <div class="language-sql line-numbers-mode"><pre class="language-sql"><code><span class="token keyword">call</span> ShowStuByName<span class="token punctuation">(</span><span class="token string">'pgmanor_1'</span><span class="token punctuation">)</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>结果</p> <table><thead><tr><th>id</th> <th>name</th> <th>age</th> <th>sex</th> <th>email</th></tr></thead> <tbody><tr><td>1</td> <td>pgmanor_1</td> <td>18</td> <td>1</td> <td>pgmanor1@qq.com</td></tr></tbody></table> <h2 id="_3-变量">3.变量</h2> <p><strong>定义变量</strong></p> <p>定义使用关键字<code>DECLARE</code>,并指定类型</p> <div class="language-sql line-numbers-mode"><pre class="language-sql"><code><span class="token keyword">DECLARE</span> l_var_int <span class="token keyword">int</span> <span class="token keyword">unsigned</span> <span class="token keyword">default</span> <span class="token number">40</span><span class="token punctuation">;</span>
<span class="token keyword">DECLARE</span> l_var_numeric number<span class="token punctuation">(</span><span class="token number">8</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">)</span> <span class="token keyword">DEFAULT</span> <span class="token number">9.95</span><span class="token punctuation">;</span>  
<span class="token keyword">DECLARE</span> l_var_datetime <span class="token keyword">datetime</span> <span class="token keyword">DEFAULT</span> <span class="token string">'1999-12-31 23:59:59'</span><span class="token punctuation">;</span>
<span class="token keyword">DECLARE</span> l_var_varchar <span class="token keyword">varchar</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span> <span class="token keyword">DEFAULT</span> <span class="token string">'This will not be padded'</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><p><strong>赋值变量</strong></p> <div class="language-sql line-numbers-mode"><pre class="language-sql"><code><span class="token keyword">set</span> l_var_int <span class="token operator">=</span> <span class="token number">20</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> l_var_int<span class="token operator">=</span><span class="token number">1</span><span class="token operator">+</span><span class="token number">2</span><span class="token operator">+</span><span class="token number">3</span><span class="token punctuation">;</span>  
<span class="token keyword">SET</span> l_var_varchar<span class="token operator">=</span><span class="token string">'Hello'</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><p><strong>使用变量</strong></p> <div class="language-sql line-numbers-mode"><pre class="language-sql"><code><span class="token keyword">SELECT</span> l_var_int<span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p><strong>示例</strong></p> <div class="language-sql line-numbers-mode"><pre class="language-sql"><code><span class="token comment">-- 使用$$作为结束符</span>
<span class="token comment">-- 使用$$作为结束符</span>
<span class="token keyword">DELIMITER</span> $$ 

<span class="token keyword">CREATE</span> <span class="token keyword">PROCEDURE</span> ShowStuByName2<span class="token punctuation">(</span>
	<span class="token keyword">INOUT</span> i_name <span class="token keyword">VARCHAR</span><span class="token punctuation">(</span><span class="token number">50</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
	<span class="token keyword">out</span> o_email <span class="token keyword">VARCHAR</span><span class="token punctuation">(</span><span class="token number">50</span><span class="token punctuation">)</span><span class="token punctuation">,</span> 
	<span class="token keyword">out</span> o_age <span class="token keyword">INT</span><span class="token punctuation">,</span> 
    <span class="token keyword">out</span> o_sex <span class="token keyword">bit</span><span class="token punctuation">)</span>
<span class="token keyword">begin</span>
	<span class="token comment">-- 定义变量</span>
	<span class="token keyword">DECLARE</span> l_var_classroom <span class="token keyword">INT</span> <span class="token keyword">DEFAULT</span> <span class="token number">0</span><span class="token punctuation">;</span>
	<span class="token comment">--  变量赋值</span>
	<span class="token keyword">set</span> l_var_classroom <span class="token operator">=</span> <span class="token number">10</span><span class="token punctuation">;</span>
	<span class="token comment">--  从表查询数据</span>
    <span class="token keyword">select</span>
    	email<span class="token punctuation">,</span> age <span class="token keyword">into</span> o_email<span class="token punctuation">,</span>o_age
    <span class="token keyword">FROM</span> student <span class="token keyword">where</span> name<span class="token operator">=</span>i_name<span class="token punctuation">;</span>
    <span class="token comment">-- 返回</span>
   	<span class="token keyword">select</span> l_var_classroom <span class="token keyword">as</span> <span class="token string">'班级'</span><span class="token punctuation">,</span> o_email <span class="token keyword">as</span> <span class="token string">'邮件'</span><span class="token punctuation">;</span>

<span class="token keyword">end</span> $$

<span class="token comment">-- 切换回;作为结束符</span>
<span class="token keyword">DELIMITER</span> <span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br></div></div><ul><li>out的参数，可以通过into方式赋值</li> <li>变量塞值通过<code>set 变量名=值;</code>方式复制</li></ul> <p><strong>调用</strong></p> <div class="language-sql line-numbers-mode"><pre class="language-sql"><code><span class="token keyword">set</span> <span class="token variable">@name</span><span class="token operator">=</span> <span class="token string">'pgmanor_1'</span>
<span class="token keyword">call</span> ShowStuByName2<span class="token punctuation">(</span><span class="token variable">@name</span><span class="token punctuation">,</span> <span class="token variable">@email</span><span class="token punctuation">,</span> <span class="token variable">@age</span><span class="token punctuation">,</span> <span class="token variable">@sex</span><span class="token punctuation">)</span>
<span class="token keyword">select</span> <span class="token variable">@name</span><span class="token punctuation">,</span><span class="token variable">@email</span><span class="token punctuation">,</span><span class="token variable">@age</span><span class="token punctuation">,</span><span class="token variable">@sex</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><blockquote><p>一般我们参数都使用<code>@xxx</code>来定义</p></blockquote> <table><thead><tr><th>@name</th> <th>@email</th> <th>@age</th> <th>@sex</th></tr></thead> <tbody><tr><td>pgmanor_1</td> <td>pgmanor1@qq.com</td> <td>18</td> <td></td></tr></tbody></table> <p><strong>扩展：</strong> 变量又细分为以下</p> <ul><li>局部变量 <code>declare age int default 0;</code></li> <li>用户变量 <code>set @age=19;</code></li> <li>会话变量</li> <li>全局变量</li></ul> <p>不明白的可以参考下这篇文章 <a href="https://www.cnblogs.com/Brambling/p/9259375.html" target="_blank" rel="noopener noreferrer">MySQL变量的使用<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p> <h2 id="_4-条件语句">4.条件语句</h2> <p>存储过程，就相当我们编程一样，可以定义变量，也可以使用添加、循环处理</p> <h3 id="_4-1-if-then-else">4-1.if-then-else</h3> <div class="language-sql line-numbers-mode"><pre class="language-sql"><code><span class="token comment">-- 使用$$作为结束符</span>
<span class="token keyword">DELIMITER</span> $$ 
<span class="token keyword">CREATE</span> <span class="token keyword">PROCEDURE</span> ShowStuByName3<span class="token punctuation">(</span>
	<span class="token keyword">INOUT</span> i_name <span class="token keyword">VARCHAR</span><span class="token punctuation">(</span><span class="token number">50</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
	<span class="token keyword">out</span> o_email <span class="token keyword">VARCHAR</span><span class="token punctuation">(</span><span class="token number">50</span><span class="token punctuation">)</span><span class="token punctuation">,</span> 
	<span class="token keyword">out</span> o_age <span class="token keyword">INT</span><span class="token punctuation">,</span> 
	<span class="token keyword">out</span> o_sex <span class="token keyword">bit</span><span class="token punctuation">)</span>
<span class="token keyword">begin</span>
	<span class="token comment">-- 定义变量</span>
	<span class="token keyword">DECLARE</span> l_var_classroom <span class="token keyword">INT</span> <span class="token keyword">DEFAULT</span> <span class="token number">0</span><span class="token punctuation">;</span>
	<span class="token keyword">DECLARE</span> l_var_status <span class="token keyword">varchar</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span> <span class="token keyword">DEFAULT</span> <span class="token string">''</span><span class="token punctuation">;</span>
	<span class="token comment">--  变量赋值</span>
	<span class="token keyword">set</span> l_var_classroom <span class="token operator">=</span> <span class="token number">10</span><span class="token punctuation">;</span>
	<span class="token comment">--  从表查询数据</span>
    <span class="token keyword">select</span>
    	email<span class="token punctuation">,</span> age <span class="token keyword">into</span> o_email<span class="token punctuation">,</span>o_age
    <span class="token keyword">FROM</span> student <span class="token keyword">where</span> name<span class="token operator">=</span>i_name<span class="token punctuation">;</span>
    <span class="token comment">-- 条件</span>
	<span class="token keyword">if</span> o_age<span class="token operator">&gt;=</span><span class="token number">18</span> <span class="token keyword">then</span> 
		<span class="token keyword">set</span> l_var_status <span class="token operator">=</span> <span class="token string">'成年'</span><span class="token punctuation">;</span>
	<span class="token keyword">else</span> 
		<span class="token keyword">set</span> l_var_status <span class="token operator">=</span> <span class="token string">'未成年'</span><span class="token punctuation">;</span>
	<span class="token keyword">end</span> <span class="token keyword">if</span><span class="token punctuation">;</span>
   	
    <span class="token comment">-- 返回</span>
   	<span class="token keyword">select</span> 
   		l_var_status <span class="token keyword">as</span> <span class="token string">'身份'</span><span class="token punctuation">,</span>
   		l_var_classroom <span class="token keyword">as</span> <span class="token string">'班级'</span><span class="token punctuation">,</span> 
  		o_email <span class="token keyword">as</span> <span class="token string">'邮件'</span><span class="token punctuation">;</span>
<span class="token keyword">END</span> $$
<span class="token comment">-- 切换回;作为结束符</span>
<span class="token keyword">DELIMITER</span> <span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br></div></div><div class="custom-block tip"><p class="custom-block-title">注意</p> <p>注意if-then-else每个语句的分号位置，不要有遗漏。</p></div> <ul><li><code>if</code>需要<code>end if;</code>语句来结束。</li> <li>每个语句后面要记得分号</li></ul> <p><strong>调用</strong></p> <div class="language-sql line-numbers-mode"><pre class="language-sql"><code><span class="token keyword">set</span> <span class="token variable">@name</span><span class="token operator">=</span> <span class="token string">'pgmanor_1'</span>
<span class="token keyword">call</span> ShowStuByName4<span class="token punctuation">(</span><span class="token variable">@name</span><span class="token punctuation">,</span> <span class="token variable">@email</span><span class="token punctuation">,</span> <span class="token variable">@age</span><span class="token punctuation">,</span> <span class="token variable">@sex</span><span class="token punctuation">)</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><strong>结果</strong></p> <table><thead><tr><th>身份</th> <th>班级</th> <th>邮件</th></tr></thead> <tbody><tr><td>成年</td> <td>10</td> <td>pgmanor1@qq.com</td></tr></tbody></table> <h3 id="_4-2-case">4-2.case</h3> <p>case与if语句类似作用</p> <div class="language-sql line-numbers-mode"><pre class="language-sql"><code><span class="token comment">-- 使用$$作为结束符</span>
<span class="token keyword">DELIMITER</span> $$ 
<span class="token keyword">CREATE</span> <span class="token keyword">PROCEDURE</span> ShowStuByName4<span class="token punctuation">(</span>
	<span class="token keyword">INOUT</span> i_name <span class="token keyword">VARCHAR</span><span class="token punctuation">(</span><span class="token number">50</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
	<span class="token keyword">out</span> o_email <span class="token keyword">VARCHAR</span><span class="token punctuation">(</span><span class="token number">50</span><span class="token punctuation">)</span><span class="token punctuation">,</span> 
	<span class="token keyword">out</span> o_age <span class="token keyword">INT</span><span class="token punctuation">,</span> 
	<span class="token keyword">out</span> o_sex <span class="token keyword">bit</span><span class="token punctuation">)</span>
<span class="token keyword">begin</span>
	<span class="token comment">-- 定义变量</span>
	<span class="token keyword">DECLARE</span> l_var_classroom <span class="token keyword">INT</span> <span class="token keyword">DEFAULT</span> <span class="token number">0</span><span class="token punctuation">;</span>
	<span class="token keyword">DECLARE</span> l_var_status <span class="token keyword">varchar</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span> <span class="token keyword">DEFAULT</span> <span class="token string">''</span><span class="token punctuation">;</span>
	<span class="token keyword">DECLARE</span> l_var_sex <span class="token keyword">varchar</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span> <span class="token keyword">DEFAULT</span> <span class="token string">''</span><span class="token punctuation">;</span>
	<span class="token comment">--  变量赋值</span>
	<span class="token keyword">set</span> l_var_classroom <span class="token operator">=</span> <span class="token number">10</span><span class="token punctuation">;</span>
	<span class="token comment">--  从表查询数据</span>
    <span class="token keyword">select</span>
    	email<span class="token punctuation">,</span> age<span class="token punctuation">,</span> sex <span class="token keyword">into</span> o_email<span class="token punctuation">,</span>o_age<span class="token punctuation">,</span> o_sex
    <span class="token keyword">FROM</span> student <span class="token keyword">where</span> name<span class="token operator">=</span>i_name<span class="token punctuation">;</span>
 	<span class="token comment">-- 条件</span>
    <span class="token keyword">case</span> o_sex
	<span class="token keyword">when</span> <span class="token number">0</span> <span class="token keyword">then</span> 
		<span class="token keyword">set</span> l_var_sex <span class="token operator">=</span> <span class="token string">'女'</span><span class="token punctuation">;</span>
	<span class="token keyword">when</span> <span class="token number">1</span> <span class="token keyword">then</span> 
		<span class="token keyword">set</span> l_var_sex <span class="token operator">=</span> <span class="token string">'男'</span><span class="token punctuation">;</span>
	<span class="token keyword">else</span> 
		<span class="token keyword">set</span> l_var_sex <span class="token operator">=</span> <span class="token string">'保密'</span><span class="token punctuation">;</span>
	<span class="token keyword">end</span> <span class="token keyword">case</span><span class="token punctuation">;</span>
    
	<span class="token comment">-- 返回</span>
   	<span class="token keyword">select</span> 
   		l_var_sex <span class="token keyword">as</span> <span class="token string">'性别'</span><span class="token punctuation">,</span>
   		l_var_classroom <span class="token keyword">as</span> <span class="token string">'班级'</span><span class="token punctuation">,</span> 
  		o_email <span class="token keyword">as</span> <span class="token string">'邮件'</span><span class="token punctuation">;</span>
<span class="token keyword">END</span> $$
<span class="token comment">-- 切换回;作为结束符</span>
<span class="token keyword">DELIMITER</span> <span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br></div></div><ul><li><code>case</code>需要<code>end case;</code>语句来结束。</li></ul> <p><strong>调用</strong></p> <div class="language-sql line-numbers-mode"><pre class="language-sql"><code><span class="token keyword">set</span> <span class="token variable">@name</span><span class="token operator">=</span> <span class="token string">'pgmanor_1'</span>
<span class="token keyword">call</span> ShowStuByName4<span class="token punctuation">(</span><span class="token variable">@name</span><span class="token punctuation">,</span> <span class="token variable">@email</span><span class="token punctuation">,</span> <span class="token variable">@age</span><span class="token punctuation">,</span> <span class="token variable">@sex</span><span class="token punctuation">)</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><strong>结果</strong></p> <table><thead><tr><th>性别</th> <th>班级</th> <th>邮件</th></tr></thead> <tbody><tr><td>男</td> <td>10</td> <td>pgmanor1@qq.com</td></tr></tbody></table> <h3 id="_4-3-循环">4-3.循环</h3> <p>循环语句有以下几种语法</p> <ul><li>while ···· end while</li> <li>repeat···· end repeat</li> <li>loop ·····endloop</li></ul> <p><strong>while方式</strong></p> <div class="language-sql line-numbers-mode"><pre class="language-sql"><code><span class="token comment">-- 使用$$作为结束符</span>
<span class="token keyword">DELIMITER</span> $$ 

<span class="token keyword">CREATE</span> <span class="token keyword">PROCEDURE</span> autoInsertDataWhile<span class="token punctuation">(</span><span class="token operator">in</span> i_name_prefix <span class="token keyword">varchar</span><span class="token punctuation">(</span><span class="token number">20</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token operator">IN</span> i_end <span class="token keyword">INT</span><span class="token punctuation">)</span>
<span class="token keyword">begin</span>
	<span class="token comment">-- 定义变量</span>
	<span class="token keyword">DECLARE</span> l_var_count <span class="token keyword">INT</span> <span class="token keyword">DEFAULT</span> <span class="token number">0</span><span class="token punctuation">;</span>
	<span class="token keyword">while</span> l_var_count<span class="token operator">&lt;</span>i_end <span class="token keyword">do</span>
		<span class="token keyword">insert</span> <span class="token keyword">into</span> student<span class="token punctuation">(</span>name<span class="token punctuation">,</span> age<span class="token punctuation">,</span> sex<span class="token punctuation">,</span> email<span class="token punctuation">)</span>
		<span class="token keyword">values</span> <span class="token punctuation">(</span>concat<span class="token punctuation">(</span>i_name_prefix<span class="token punctuation">,</span> l_var_count<span class="token punctuation">)</span><span class="token punctuation">,</span> l_var_count<span class="token punctuation">,</span> l_var_count<span class="token operator">%</span><span class="token number">2</span><span class="token punctuation">,</span> concat<span class="token punctuation">(</span><span class="token string">'pg'</span><span class="token punctuation">,</span> l_var_count<span class="token punctuation">,</span><span class="token string">'@qq.com'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		<span class="token comment">-- 变量+1</span>
		<span class="token keyword">set</span> l_var_count<span class="token operator">=</span>l_var_count<span class="token operator">+</span><span class="token number">1</span><span class="token punctuation">;</span>
	<span class="token keyword">end</span> <span class="token keyword">while</span><span class="token punctuation">;</span>
<span class="token keyword">end</span> $$

<span class="token comment">-- 切换回;作为结束符</span>
<span class="token keyword">DELIMITER</span> <span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br></div></div><blockquote><p><code>while... do .... end while</code> 语法结构</p></blockquote> <p><strong>调用</strong></p> <div class="language-sql line-numbers-mode"><pre class="language-sql"><code><span class="token keyword">call</span> autoInsertDataWhile<span class="token punctuation">(</span><span class="token string">'pgmanor'</span><span class="token punctuation">,</span> <span class="token number">10</span><span class="token punctuation">)</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p><strong>repeat方式</strong></p> <div class="language-sql line-numbers-mode"><pre class="language-sql"><code><span class="token comment">-- 使用$$作为结束符</span>
<span class="token keyword">DELIMITER</span> $$ 

<span class="token keyword">CREATE</span> <span class="token keyword">PROCEDURE</span> autoInsertDataRepeat<span class="token punctuation">(</span><span class="token operator">in</span> i_name_prefix <span class="token keyword">varchar</span><span class="token punctuation">(</span><span class="token number">20</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token operator">IN</span> i_end <span class="token keyword">INT</span><span class="token punctuation">)</span>
<span class="token keyword">begin</span>
	<span class="token comment">-- 定义变量</span>
	<span class="token keyword">DECLARE</span> l_var_count <span class="token keyword">INT</span> <span class="token keyword">DEFAULT</span> <span class="token number">0</span><span class="token punctuation">;</span>
	<span class="token keyword">repeat</span>
		<span class="token keyword">insert</span> <span class="token keyword">into</span> student<span class="token punctuation">(</span>name<span class="token punctuation">,</span> age<span class="token punctuation">,</span> sex<span class="token punctuation">,</span> email<span class="token punctuation">)</span>
		<span class="token keyword">values</span> <span class="token punctuation">(</span>concat<span class="token punctuation">(</span>i_name_prefix<span class="token punctuation">,</span> l_var_count<span class="token punctuation">)</span><span class="token punctuation">,</span> l_var_count<span class="token punctuation">,</span> l_var_count<span class="token operator">%</span><span class="token number">2</span><span class="token punctuation">,</span> concat<span class="token punctuation">(</span><span class="token string">'pg'</span><span class="token punctuation">,</span> l_var_count<span class="token punctuation">,</span><span class="token string">'@qq.com'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		<span class="token comment">-- 变量+1</span>
		<span class="token keyword">set</span> l_var_count<span class="token operator">=</span>l_var_count<span class="token operator">+</span><span class="token number">1</span><span class="token punctuation">;</span>
	until l_var_count<span class="token operator">&gt;=</span>i_end
	<span class="token keyword">end</span> <span class="token keyword">repeat</span><span class="token punctuation">;</span>
<span class="token keyword">end</span> $$

<span class="token comment">-- 切换回;作为结束符</span>
<span class="token keyword">DELIMITER</span> <span class="token punctuation">;</span>

</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br></div></div><blockquote><p><code>repeat... until .... end repeat</code> 语法结构</p></blockquote> <p><strong>调用</strong></p> <div class="language-sql line-numbers-mode"><pre class="language-sql"><code><span class="token keyword">call</span> autoInsertDataRepeat<span class="token punctuation">(</span><span class="token string">'xiaoai'</span><span class="token punctuation">,</span> <span class="token number">10</span><span class="token punctuation">)</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p><em>loop方式</em>*</p> <div class="language-sql line-numbers-mode"><pre class="language-sql"><code><span class="token comment">-- 使用$$作为结束符</span>
<span class="token keyword">DELIMITER</span> $$ 

<span class="token keyword">CREATE</span> <span class="token keyword">PROCEDURE</span> autoInsertDataLoop<span class="token punctuation">(</span><span class="token operator">in</span> i_name_prefix <span class="token keyword">varchar</span><span class="token punctuation">(</span><span class="token number">20</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token operator">IN</span> i_end <span class="token keyword">INT</span><span class="token punctuation">)</span>
<span class="token keyword">begin</span>
	<span class="token comment">-- 定义变量</span>
	<span class="token keyword">DECLARE</span> l_var_count <span class="token keyword">INT</span> <span class="token keyword">DEFAULT</span> <span class="token number">0</span><span class="token punctuation">;</span>
	<span class="token comment">-- 定义一个loop点</span>
	loop_flag1: <span class="token keyword">loop</span>
		<span class="token keyword">insert</span> <span class="token keyword">into</span> student<span class="token punctuation">(</span>name<span class="token punctuation">,</span> age<span class="token punctuation">,</span> sex<span class="token punctuation">,</span> email<span class="token punctuation">)</span>
		<span class="token keyword">values</span> <span class="token punctuation">(</span>concat<span class="token punctuation">(</span>i_name_prefix<span class="token punctuation">,</span> l_var_count<span class="token punctuation">)</span><span class="token punctuation">,</span> l_var_count<span class="token punctuation">,</span> l_var_count<span class="token operator">%</span><span class="token number">2</span><span class="token punctuation">,</span> concat<span class="token punctuation">(</span><span class="token string">'pg'</span><span class="token punctuation">,</span> l_var_count<span class="token punctuation">,</span><span class="token string">'@qq.com'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		<span class="token comment">-- 变量+1</span>
		<span class="token keyword">set</span> l_var_count<span class="token operator">=</span>l_var_count<span class="token operator">+</span><span class="token number">1</span><span class="token punctuation">;</span>
		<span class="token comment">-- 终止循环体条件</span>
		<span class="token keyword">if</span> l_var_count <span class="token operator">&gt;=</span> i_end <span class="token keyword">then</span> 
			<span class="token keyword">leave</span> loop_flag1<span class="token punctuation">;</span>
		<span class="token keyword">end</span> <span class="token keyword">if</span><span class="token punctuation">;</span> 
	<span class="token keyword">end</span> <span class="token keyword">loop</span><span class="token punctuation">;</span>
<span class="token keyword">end</span> $$

<span class="token comment">-- 切换回;作为结束符</span>
<span class="token keyword">DELIMITER</span> <span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br></div></div><p><strong>调用</strong></p> <div class="language-sql line-numbers-mode"><pre class="language-sql"><code><span class="token keyword">call</span> autoInsertDataLoop<span class="token punctuation">(</span><span class="token string">'happy'</span><span class="token punctuation">,</span> <span class="token number">10</span><span class="token punctuation">)</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div></div> <footer class="page-edit" style="display:none;"><!----> <div class="last-updated"><span class="prefix">Last Updated: </span> <span class="time">2020-12-20 11:21:37 PM</span></div></footer> <!----> <!----> <!----></main> <!----></div></div></div></div><div class="global-ui"><div class="back-to-ceiling" style="right:1rem;bottom:6rem;width:2.5rem;height:2.5rem;border-radius:.25rem;line-height:2.5rem;display:none;" data-v-c6073ba8 data-v-c6073ba8><svg t="1574745035067" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5404" class="icon" data-v-c6073ba8><path d="M526.60727968 10.90185116a27.675 27.675 0 0 0-29.21455937 0c-131.36607665 82.28402758-218.69155461 228.01873535-218.69155402 394.07834331a462.20625001 462.20625001 0 0 0 5.36959153 69.94390903c1.00431239 6.55289093-0.34802892 13.13561351-3.76865779 18.80351572-32.63518765 54.11355614-51.75690182 118.55860487-51.7569018 187.94566865a371.06718723 371.06718723 0 0 0 11.50484808 91.98906777c6.53300375 25.50556257 41.68394495 28.14064038 52.69160883 4.22606766 17.37162448-37.73630017 42.14135425-72.50938081 72.80769204-103.21549295 2.18761121 3.04276886 4.15646224 6.24463696 6.40373557 9.22774369a1871.4375 1871.4375 0 0 0 140.04691725 5.34970492 1866.36093723 1866.36093723 0 0 0 140.04691723-5.34970492c2.24727335-2.98310674 4.21612437-6.18497483 6.3937923-9.2178004 30.66633723 30.70611158 55.4360664 65.4791928 72.80769147 103.21549355 11.00766384 23.91457269 46.15860503 21.27949489 52.69160879-4.22606768a371.15156223 371.15156223 0 0 0 11.514792-91.99901164c0-69.36717486-19.13165746-133.82216804-51.75690182-187.92578088-3.42062944-5.66790279-4.76302748-12.26056868-3.76865837-18.80351632a462.20625001 462.20625001 0 0 0 5.36959269-69.943909c-0.00994388-166.08943902-87.32547796-311.81420293-218.6915546-394.09823051zM605.93803103 357.87693858a93.93749974 93.93749974 0 1 1-187.89594924 6.1e-7 93.93749974 93.93749974 0 0 1 187.89594924-6.1e-7z" p-id="5405" data-v-c6073ba8></path><path d="M429.50777625 765.63860547C429.50777625 803.39355007 466.44236686 1000.39046097 512.00932183 1000.39046097c45.56695499 0 82.4922232-197.00623328 82.5015456-234.7518555 0-37.75494459-36.9345906-68.35043303-82.4922232-68.34111062-45.57627738-0.00932239-82.52019037 30.59548842-82.51086798 68.34111062z" p-id="5406" data-v-c6073ba8></path></svg></div><!----><!----><APlayer audio="" fixed="true" mini="true" theme="#f9bcdd" loop="loop" order="random" preload="auto" volume="0.1" mutex="true" lrc-type="0" list-folded="true" list-max-height="250" storage-name="vuepress-plugin-meting" id="aplayer-fixed"></APlayer></div></div>
    <script src="/manor-farm-mysql/assets/js/app.bbd54b43.js" defer></script><script src="/manor-farm-mysql/assets/js/3.33fa8ee0.js" defer></script><script src="/manor-farm-mysql/assets/js/1.e501e4e7.js" defer></script><script src="/manor-farm-mysql/assets/js/41.64d0c11a.js" defer></script><script src="/manor-farm-mysql/assets/js/8.73e907b5.js" defer></script>
  </body>
</html>
